#include<iostream>
#include<algorithm>
using namespace std;
const int N = 20;
int w[N];
int cnt[N];
int n, m;
int ans = N;
int cmp(int a, int b)
{
	return a > b;
}

void dfs(int u, int k)
{
	if (k >= ans) {
		return;
	}
	if (u == n) {
		ans = k;
		return;
	}
	for (int i = 0; i < k; i++) {
		if (cnt[i] + w[u] <= m) {
			cnt[i] += w[u];
			dfs(u + 1, k);
			cnt[i] -= w[u];
		}
	}
	cnt[k] = w[u];
	dfs(u + 1, k + 1);
	cnt[k] = 0;
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
	}
	sort(w, w + n, cmp);
	dfs(0, 0);
	cout << ans << endl;
	return 0;
}